package com.example.mycomposelearing.utils

import android.content.Context
import android.graphics.Point
import android.view.WindowManager

/**
 *@Author tgw
 *@Date 2023/08/22
 *@describe
 */
object ScreenUtils {
    fun getAppScreenWidth(context: Context): Int {
        val wm = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
            ?: return -1
        val point = Point()
        wm.defaultDisplay.getSize(point)
        return point.x
    }

    fun getAppScreenHeight(context: Context): Int {
        val wm =context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
            ?: return -1
        val point = Point()
        wm.defaultDisplay.getSize(point)
        return point.y
    }
}